<template>
	<Table :columns="tableColumn" :data="family" :loading="loading"></Table>
</template>
<script>
import {  customerGet, } from '@api/customer.js'

export default {
    props: {
        cur: {
            type: Object,
            required: true,
            default: {
                id: ''
            },
        }
    },
	data() {
		return {
            loading: false,
			tableColumn: [
				{
                    title: '关系',
                    align:'center',
					key: 'familyRemark'
				},
				{
                    title: '姓名',
                    align:'center',
					key: 'familyName'
				},
				{
                    align:'center',
                    title: '手机号',
					key: 'familyMobile'
                },
			],
			family: [
			]
		}
    },
    methods: {
        getFamily() {
            const { id } = this.cur;
            if (id) {
                this.loading = true;
                customerGet({id}).then(res => {
                    this.loading = false;
                    console.log("res-->", res)
                    const { customerFamilyList } = res.data;
                    this.family = customerFamilyList;
                    console.log("customerFamilyList>", customerFamilyList)
                }).catch(err => this.loading = false)
            }
            console.log("getFamily-->", id)
        },
    },
    watch: {
        cur(after){
            this.getFamily()
        }
    }
}
</script>
